﻿using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using VisionCloud.Domain.Common;
using VisionCloud.Domain.DtoModel.Schedule.ProjectInfo;
using VisionCloud.Domain.Filters;
using VisionCloud.Service.Schedule;

namespace VisionCloud.Api.Controllers.Schedule
{
    /// <summary>
    /// 调度项目模块控制器
    /// </summary>
    [SystemModule("调度项目模块控制器")]
    [ApiVersion("1.0")]
    [Route("api/schedule/[Controller]/[Action]")]
    [ApiExplorerSettings(GroupName = "调度项目模块控制器")]
    public class ProjectController : ApiBaseController
    {
        public ScheduleProjectService ScheduleProjectService { get; set; }

        /// <summary>
        /// 获取项目坐标列表
        /// </summary>
        /// <returns></returns>
        [HttpPost, SwaggerOperation(Tags = new[] { "获取项目坐标列表" })]
        public async Task<ApiResult> GetProjectInfoList()
        {
            List<ScheduleProjectLocaltionDto> data = ScheduleProjectService.GetLocaltionList();
            return new ApiResult
            {
                Code = AjaxCode.Success,
                Result = data
            };
        }

        /// <summary>
        /// 获取项目详情
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpGet, SwaggerOperation(Tags = new[] { "获取项目详情" })]
        public async Task<ApiResult> GetProjectDetail(Guid id)
        {
            ScheduleProjectDetailDto data = ScheduleProjectService.GetProjectDetail(id);
            return new ApiResult
            {
                Code = AjaxCode.Success,
                Result = data
            };
        }
    }
}
